/**
 * 
 */
package com.autonavi.car.si.FileStore.model;

import java.io.InputStream;

/**
 * 文件上传VO
 * 
 * @author kucheng.liao@autonavi.com
 * @date Nov 24, 2014
 * 
 */
public class FileVO {

	public static enum FileOperate{
		STOR,GET;
		private FileOperate(){
			
		}
	}
	/**
	 * 操作
	 */
	private FileOperate operate=FileOperate.STOR;
	
	private int slice;
	
	private String date;
	
	
	private volatile int status;
	/**
	 * 输入流
	 */
	private InputStream in;
	/**
	 * 文件唯一名称
	 */
	private String uniqueFileName;
	/**
	 * FTP服务端的存储路径
	 */
	private String storePath;

	/**
	 * @return the in
	 */
	public InputStream getIn() {
		return in;
	}

	/**
	 * @param in
	 *            the in to set
	 */
	public void setIn(InputStream in) {
		this.in = in;
	}

	/**
	 * @return the uniqueFileName
	 */
	public String getUniqueFileName() {
		return uniqueFileName;
	}

	/**
	 * @param uniqueFileName
	 *            the uniqueFileName to set
	 */
	public void setUniqueFileName(String uniqueFileName) {
		this.uniqueFileName = uniqueFileName;
	}

	/**
	 * @return the storePath
	 */
	public String getStorePath() {
		return storePath;
	}

	/**
	 * @param storePath
	 *            the storePath to set
	 */
	public void setStorePath(String storePath) {
		this.storePath = storePath;
	}

	public void dataWait() {
		int size = 10;
		int time = 1000;
		while (status == 0) {
			synchronized (this) {
				if (status == 0) {
					try {
						this.wait(time);
					} catch (InterruptedException e) {
					}
				}
			}
			if (size > 0) {
				time = time << 1;
				size--;
			}
		}
	}

	public void setStatus(int status) {
		synchronized (this) {
			this.status = status;
			this.notify();
		}
	}

	/**
	 * @return the status
	 */
	public int getStatus() {
		return status;
	}

	/**
	 * @return the slice
	 */
	public int getSlice() {
		return slice;
	}

	/**
	 * @param slice the slice to set
	 */
	public void setSlice(int slice) {
		this.slice = slice;
	}

	/**
	 * @return the date
	 */
	public String getDate() {
		return date;
	}

	/**
	 * @param date the date to set
	 */
	public void setDate(String date) {
		this.date = date;
	}

	/**
	 * @return the operate
	 */
	public FileOperate getOperate() {
		return operate;
	}

	/**
	 * @param operate the operate to set
	 */
	public void setOperate(FileOperate operate) {
		this.operate = operate;
	}
	
}
